<table class="table table-bordered" style="margin-top: 0px;">
    <thead>
    <tr>
        <th width="8%">拍卖单号</th>
        <th width="16%">车型</th>
        <th width="5%">所在地</th>
        <if condition="$params.status eq 1 OR $params.status eq 2 OR $params.status eq 3">
                <th width="8%">车主姓名</th>
                <th width="10%">车主电话</th>
            <elseif condition="$params.status eq 4" />
                <th width="6%">磋商成交价</th>
        </if>
        <if condition="$params.status eq 4">
            <th width="6%">拍卖最高价</th>
            <else />
            <th width="6%">第一名出价</th>
        </if>

        <th width="6%">保留价</th>
        <if condition="$params.status eq 4">
            <th width="10%">渠道来源</th>
            <if condition="$params.auth AND $params.status eq 4">
                <th width="6%">操作客服</th>
            </if>
            <th width="12%">磋商时间</th>
        </if>
        <if condition="$params.auth AND $params.status gt 1 AND $params.status neq 4">
            <th width="6%">操作客服</th>
        </if>
        <if condition="$params.status eq 2">
            <th width="10%">下次跟踪时间</th>
        </if>
        <th width="6%">操作</th>

    </tr>
    </thead>
    <tbody>
    <volist name="list" id="vo" key="k">
        <tr>
            <td class="mcenter">{$vo.order_no}</td>
            <td><a href="/Car/report/car_id/{$vo.car_id}" target="_blank">{$vo.model}</a></td>
            <td class="mcenter">{$vo.location_area_name}</td>
            <if condition="$params.status eq 1">
                <td class="mcenter">{$vo.seller_name}</td>
                <td class="mcenter">{$vo.phone_has_star}</td>
                <elseif condition="$params.status eq 2 OR $params.status eq 3"/>
                <td class="mcenter">{$vo.seller_name}</td>
                <td class="mcenter">{$vo.phone}</td>
                <elseif condition="$params.status eq 4" />
                <td class="mcenter">{$vo.consult_price}</td>
            </if>
            <td class="mcenter">{$vo.bidding_best_price}</td>
            <td class="mcenter">{$vo.reserve_price}</td>
            <if condition="$params.status eq 4">
                <td  class="mcenter">{$vo.channel_from}</td>
                <if condition="$params.auth AND $params.status eq 4">
                    <td  class="mcenter">{$vo.consult_service}</td>
                </if>
                <td class="mcenter">
                     {$vo.consult_time}
                </td>
            </if>
            <if condition="$params.auth AND $params.status gt 1 AND $params.status neq 4">
                <td class="mcenter">{$vo.consult_service}</td>
            </if>
            <if condition="$params.status eq 2">
                <td class="mcenter">{$vo.next_trace_time}</td>
            </if>
            <td class="mcenter">
                <if condition="$params.status eq 1 AND $vo.emp_id eq 0">
                    <a onclick="is_trace_assigned('{$vo.id}','{$vo.consult_status}');" href="javascript:;">磋商</a>
                <elseif condition="$params.status eq 2 AND $vo.emp_id gt 0 AND $vo['emp_id'] eq $params['emp_id']" />
                    <if condition="$params.fenpei_auth eq true">
                        <a href="{:U('Consult/consult_deal',['status'=>$vo[consult_status],'id'=>$vo[id]])}">磋商</a>
                        <a href="javascript:;" onclick="fenpei('{$vo.id}');">分配</a>
                        <else/>
                        <a href="{:U('Consult/consult_deal',['status'=>$vo[consult_status],'id'=>$vo[id]])}">磋商</a>
                    </if>
                <elseif condition="$params.fenpei_auth AND $params.status eq 2 AND $vo.emp_id gt 0 AND $vo['emp_id'] neq $params['emp_id']" />
                    <a href="javascript:;" onclick="fenpei('{$vo.id}');">分配</a>
                <elseif condition="$params.status eq 3 OR $params.status eq 4" />
                    <a href="{:U('Consult/consult_view',['status'=>$vo[consult_status],'id'=>$vo[id]])}" target="_blank">查看</a>
                <elseif condition="$params.status eq 5" />
                    <if condition="$vo[status] eq 12 and ($vo[fail_type] eq 2 or $vo[fail_type] eq 6) and $vo[car_status] eq 8">
                        <a href="javascript:;" onclick="re_auction('{$vo.order_id}','{$vo.owner_id}')">重拍</a>
                    <elseif condition="($vo[status] eq 12) and ($vo[fail_type] eq 2 or $vo[fail_type] eq 6 )" />
                        <a href="javascript:void(0);" style="color:#7f7f7f;">已重拍</a>
                    </if>
                    <a href="{:U('Consult/consult_view',['status'=>$vo[consult_status],'id'=>$vo[id]])}" target="_blank">查看</a>
                </if>
            </td>
        </tr>
    </volist>
    </tbody>
</table>
<div class="error msg" style="color: red; text-align:left;">{$errMsg}</div>
<div class="pageFaye"><div class="pager">{$page}</div><div class="clear"></div></div>

<div class="deparHover" style="height: 200px;">
    <h4>分配客服</h4>
    <label>
        <select name="service_id" id="service_id" style="float: right;width: 360px;">
            <option value="0">请选择客服</option>
            <?php foreach($kfs as $kf):?>
            <option value="{$kf.emp_id}">{$kf.real_name}</option>
            <?php endforeach;?>
        </select>
        分配给：
    </label>
    <div class="deparBtn">
        <input type="button" value="确定" class="deparQue" id="fenpeiQueding">
        <input type="button" value="取消" id="fenpeiQuxiao">
    </div>
</div>

<script type="text/javascript">
    function fenpei(consult_id){
        var bg = $(".yunBei");
        var pp = $(".deparHover");
        var qd = $("#fenpeiQueding");
        var qx = $("#fenpeiQuxiao");

        $("#service_id").select2();
        bg.show();
        pp.show();
        $([bg,qd,qx]).each(function(i,n){
            $(n).unbind('click');
        });
        qx.click(hide_pp);
        bg.click(hide_pp);
        qd.click(function(){
            var service_id = $("#service_id").val();
            $.post("/Consult/assignServer",{"consult_id":consult_id, "service_id":service_id},function(data){
                if(data.code != 200){
                    shibai_alert(data.msg, 1500);
                    return false;
                }
                btn_alert("分配成功",1000,function(){
                    window.location.reload();
                });
            },"json");
        });
        function hide_pp(){
            bg.hide();
            pp.hide();
            bg.unbind('click');
        }
    }
</script>
